<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css" />
        <script>
            $(function() {
                $( "#datepicker" ).datepicker({ dateFormat: "dd.mm.yy" });
                $("#datepicker").datepicker();
            });
        </script>
    </head>
    <body>
        <form:form modelAttribute="person" method="post" action="/admin/person/edit" >
            <div class="colmask threecol">
                <div class="colmid">
                    <div class="colleft">
                        <div class="col1" >
                            <h1>Contacts</h1>
                            <table class="simple">
                                <tr>
                                    <td>Phone</td>
                                    <td><form:input path="phoneNumber" /></td>
                                </tr>
                                <tr>
                                    <td>Email</td>
                                    <td><form:input path="email" /></td>
                                </tr>
                            </table>
                        </div>
                        <div class="col2" >
                            <table class="simple">
                                <tr>
                                    <td>First name</td>
                                    <td><form:input path="firstName" maxlength="100" /></td>
                                </tr>
                                <tr>
                                    <td>Last name</td>
                                    <td><form:input path="lastName" /></td>
                                </tr>
                                <tr>
                                    <td>Date of Birth</td>
                                    <td><form:input path="dateOfBirth" id="datepicker" /></td>
                                </tr>
                            </table>
                        </div>
                        <div class="col3">
                            <h1>Address</h1>
                            <table class="simple">
                                <tr>
                                    <td>Street with number</td>
                                    <td><form:input path="address.streetAndNumber" /></td>
                                </tr>
                                <tr>
                                    <td>City</td>
                                    <td><form:input path="address.city" /></td>
                                </tr>
                                <tr>
                                    <td>Zip Code</td>
                                    <td><form:input path="address.zipCode" /></td>
                                </tr>
                                <tr>
                                    <td>Country</td>
                                    <td><form:input path="address.country" /></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <input type="submit" value="<c:if test="${not empty person.id}" >Edit</c:if><c:if test="${empty person.id}" >Add</c:if>" />
            <br>
            <br>
            <form:errors path="*"/>
        </form:form>
           
    </body>
</html>
